home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / QuickTime™ 3.0b11 / QTPublicInterfaces / CIncludes / SFNTTypes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-12  |  6.2 KB  |  302 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        SFNTTypes.h
  3.  
  4.      Contains:    Font file structures.
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    QuickTime 3.0 Beta
  8.  
  9.      Copyright:    © 1994-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __SFNTTYPES__
  19. #define __SFNTTYPES__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24.  
  25.  
  26.  
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_STRUCT_ALIGN
  40.     #pragma options align=mac68k
  41. #elif PRAGMA_STRUCT_PACKPUSH
  42.     #pragma pack(push, 2)
  43. #elif PRAGMA_STRUCT_PACK
  44.     #pragma pack(2)
  45. #endif
  46.  
  47.  
  48. struct sfntDirectoryEntry {
  49.     FourCharCode                     tableTag;
  50.     UInt32                             checkSum;
  51.     UInt32                             offset;
  52.     UInt32                             length;
  53. };
  54. typedef struct sfntDirectoryEntry        sfntDirectoryEntry;
  55. /* The search fields limits numOffsets to 4096. */
  56.  
  57. struct sfntDirectory {
  58.     FourCharCode                     format;
  59.     UInt16                             numOffsets;                    /* number of tables */
  60.     UInt16                             searchRange;                /* (max2 <= numOffsets)*16 */
  61.     UInt16                             entrySelector;                /* log2(max2 <= numOffsets) */
  62.     UInt16                             rangeShift;                    /* numOffsets*16-searchRange*/
  63.     sfntDirectoryEntry                 table[1];                    /* table[numOffsets] */
  64. };
  65. typedef struct sfntDirectory            sfntDirectory;
  66.  
  67. enum {
  68.     sizeof_sfntDirectory        = 12
  69. };
  70.  
  71. /* Cmap - character id to glyph id mapping */
  72.  
  73. enum {
  74.     cmapFontTableTag            = FOUR_CHAR_CODE('cmap')
  75. };
  76.  
  77.  
  78. struct sfntCMapSubHeader {
  79.     UInt16                             format;
  80.     UInt16                             length;
  81.     UInt16                             languageID;                    /* base-1 */
  82. };
  83. typedef struct sfntCMapSubHeader        sfntCMapSubHeader;
  84.  
  85. enum {
  86.     sizeof_sfntCMapSubHeader    = 6
  87. };
  88.  
  89.  
  90. struct sfntCMapEncoding {
  91.     UInt16                             platformID;                    /* base-0 */
  92.     UInt16                             scriptID;                    /* base-0 */
  93.     UInt32                             offset;
  94. };
  95. typedef struct sfntCMapEncoding            sfntCMapEncoding;
  96.  
  97. enum {
  98.     sizeof_sfntCMapEncoding        = 8
  99. };
  100.  
  101.  
  102. struct sfntCMapHeader {
  103.     UInt16                             version;
  104.     UInt16                             numTables;
  105.     sfntCMapEncoding                 encoding[1];
  106. };
  107. typedef struct sfntCMapHeader            sfntCMapHeader;
  108.  
  109. enum {
  110.     sizeof_sfntCMapHeader        = 4
  111. };
  112.  
  113. /* Name table */
  114.  
  115. enum {
  116.     nameFontTableTag            = FOUR_CHAR_CODE('name')
  117. };
  118.  
  119.  
  120. struct sfntNameRecord {
  121.     UInt16                             platformID;                    /* base-0 */
  122.     UInt16                             scriptID;                    /* base-0 */
  123.     UInt16                             languageID;                    /* base-0 */
  124.     UInt16                             nameID;                        /* base-0 */
  125.     UInt16                             length;
  126.     UInt16                             offset;
  127. };
  128. typedef struct sfntNameRecord            sfntNameRecord;
  129.  
  130. enum {
  131.     sizeof_sfntNameRecord        = 12
  132. };
  133.  
  134.  
  135. struct sfntNameHeader {
  136.     UInt16                             format;
  137.     UInt16                             count;
  138.     UInt16                             stringOffset;
  139.     sfntNameRecord                     rec[1];
  140. };
  141. typedef struct sfntNameHeader            sfntNameHeader;
  142.  
  143. enum {
  144.     sizeof_sfntNameHeader        = 6
  145. };
  146.  
  147. /* Fvar table - font variations */
  148.  
  149. enum {
  150.     variationFontTableTag        = FOUR_CHAR_CODE('fvar')
  151. };
  152.  
  153. /* These define each font variation */
  154.  
  155. struct sfntVariationAxis {
  156.     FourCharCode                     axisTag;
  157.     Fixed                             minValue;
  158.     Fixed                             defaultValue;
  159.     Fixed                             maxValue;
  160.     SInt16                             flags;
  161.     SInt16                             nameID;
  162. };
  163. typedef struct sfntVariationAxis        sfntVariationAxis;
  164.  
  165. enum {
  166.     sizeof_sfntVariationAxis    = 20
  167. };
  168.  
  169. /* These are named locations in style-space for the user */
  170.  
  171. struct sfntInstance {
  172.     SInt16                             nameID;
  173.     SInt16                             flags;
  174.     Fixed                             coord[1];                    /* [axisCount] */
  175.                                                                 /* room to grow since the header carries a tupleSize field */
  176. };
  177. typedef struct sfntInstance                sfntInstance;
  178.  
  179. enum {
  180.     sizeof_sfntInstance            = 4
  181. };
  182.  
  183.  
  184. struct sfntVariationHeader {
  185.     Fixed                             version;                    /* 1.0 Fixed */
  186.     UInt16                             offsetToData;                /* to first axis = 16*/
  187.     UInt16                             countSizePairs;                /* axis+inst = 2 */
  188.     UInt16                             axisCount;
  189.     UInt16                             axisSize;
  190.     UInt16                             instanceCount;
  191.     UInt16                             instanceSize;
  192.                                                                 /* …other <count,size> pairs */
  193.     sfntVariationAxis                 axis[1];                    /* [axisCount] */
  194.     sfntInstance                     instance[1];                /* [instanceCount]  …other arrays of data */
  195. };
  196. typedef struct sfntVariationHeader        sfntVariationHeader;
  197.  
  198. enum {
  199.     sizeof_sfntVariationHeader    = 16
  200. };
  201.  
  202. /* Fdsc table - font descriptor */
  203.  
  204. enum {
  205.     descriptorFontTableTag        = FOUR_CHAR_CODE('fdsc')
  206. };
  207.  
  208.  
  209. struct sfntFontDescriptor {
  210.     FourCharCode                     name;
  211.     Fixed                             value;
  212. };
  213. typedef struct sfntFontDescriptor        sfntFontDescriptor;
  214.  
  215. struct sfntDescriptorHeader {
  216.     Fixed                             version;                    /* 1.0 in Fixed */
  217.     SInt32                             descriptorCount;
  218.     sfntFontDescriptor                 descriptor[1];
  219. };
  220. typedef struct sfntDescriptorHeader        sfntDescriptorHeader;
  221.  
  222. enum {
  223.     sizeof_sfntDescriptorHeader    = 8
  224. };
  225.  
  226. /* Feat Table - layout feature table */
  227.  
  228. enum {
  229.     featureFontTableTag            = FOUR_CHAR_CODE('feat')
  230. };
  231.  
  232.  
  233. struct sfntFeatureName {
  234.     UInt16                             featureType;
  235.     UInt16                             settingCount;
  236.     SInt32                             offsetToSettings;
  237.     UInt16                             featureFlags;
  238.     UInt16                             nameID;
  239. };
  240. typedef struct sfntFeatureName            sfntFeatureName;
  241.  
  242. struct sfntFontFeatureSetting {
  243.     UInt16                             setting;
  244.     UInt16                             nameID;
  245. };
  246. typedef struct sfntFontFeatureSetting    sfntFontFeatureSetting;
  247.  
  248. struct sfntFontRunFeature {
  249.     UInt16                             featureType;
  250.     UInt16                             setting;
  251. };
  252. typedef struct sfntFontRunFeature        sfntFontRunFeature;
  253.  
  254. struct sfntFeatureHeader {
  255.     SInt32                             version;                    /* 1.0 */
  256.     UInt16                             featureNameCount;
  257.     UInt16                             featureSetCount;
  258.     SInt32                             reserved;                    /* set to 0 */
  259.     sfntFeatureName                 names[1];
  260.     sfntFontFeatureSetting             settings[1];
  261.     sfntFontRunFeature                 runs[1];
  262. };
  263. typedef struct sfntFeatureHeader        sfntFeatureHeader;
  264. /* OS/2 Table */
  265.  
  266. enum {
  267.     os2FontTableTag                = FOUR_CHAR_CODE('OS/2')
  268. };
  269.  
  270. /*  Special invalid glyph ID value, useful as a sentinel value, for example */
  271.  
  272. enum {
  273.     nonGlyphID                    = 65535L
  274. };
  275.  
  276. /* Data types for encoding components as used in interfaces */
  277.  
  278. typedef UInt32                             FontPlatformCode;
  279. typedef UInt32                             FontScriptCode;
  280. typedef UInt32                             FontLanguageCode;
  281.  
  282. #if PRAGMA_STRUCT_ALIGN
  283.     #pragma options align=reset
  284. #elif PRAGMA_STRUCT_PACKPUSH
  285.     #pragma pack(pop)
  286. #elif PRAGMA_STRUCT_PACK
  287.     #pragma pack()
  288. #endif
  289.  
  290. #ifdef PRAGMA_IMPORT_OFF
  291. #pragma import off
  292. #elif PRAGMA_IMPORT
  293. #pragma import reset
  294. #endif
  295.  
  296. #ifdef __cplusplus
  297. }
  298. #endif
  299.  
  300. #endif /* __SFNTTYPES__ */
  301.  
  302.